package bsc.war.ajax;

import bsc.ejb.entity.Person;
import bsc.ejb.entity.ScoreDomain;
import bsc.war.delegate.DelegateBSC;
import bsc.war.factory.Factory;
import bsc.war.service.BSCUtils;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

/**
 *
 * @author Miguel Angel
 */
public class WizardProjectReport extends AbstractController {

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request,
            HttpServletResponse response) throws Exception {

        try {

            DelegateBSC delegate = (DelegateBSC) Factory.getBean("DelegateBSC");

            HttpSession session = request.getSession(true);
            Person person = (Person) session.getAttribute("person");

            List<ScoreDomain> scoreDomains = BSCUtils.getAllPersonScoreDomains(delegate, person);

            request.setAttribute("scoreDomains", scoreDomains);

        } catch (Exception e) {
            e.printStackTrace();
        }

        return new ModelAndView("wizardProjectReport");
    }
}